﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using SharedLib.Network.Server;

namespace SharedLib.Engine
{

    public enum GameObjectType
    {
        GameObject,
        Light
    }

    public class GameObject
    {
        public long ID;
        public string Name;

        private Vector2 _position;

        public EntitySide Side = EntitySide.Server;
        public Point ChunkPosition = Point.Zero;

        public GameObjectType Type = GameObjectType.GameObject;

        public Vector2 Position
        {
            get
            {
                return _position;
            }
            set
            {

                Point beforeMove = getChunkPosition();

                this._position = value;

                Point afterMove = getChunkPosition();

              

               

            }
        }

        public Point getChunkPosition()
        {

            int chunkX = (int)(this.Position.X / Constants.TILE_SIZE / Constants.CHUNK_WIDTH) - (this.Position.X < 0 ? 1 : 0);
            int chunkY = (int)(this.Position.Y / Constants.TILE_SIZE / Constants.CHUNK_HEIGHT) - (this.Position.Y < 0 ? 1 : 0);
            return new Point(chunkX, chunkY);

        }
    }
}
